Page 98 - 2629_Devagiri_C-8
P. 98
LAB LEARNING 21 st
Century #Critical Thinking
Skills #Technology Literacy
1. Write a program that keeps asking the user to enter a password until the correct password
is entered.
2. Ask the user to enter a number and calculate its factorial using a loop.
3. Write a program to print numbers from 10 down to 1.
4. Write a python program to check, if the given number is prime or not.
CODE CHECK Century #Critical Thinking
21 st
Skills
Identify the errors in the following Python code and correct them:
correct_username = "admin'
correct_password = "admin123"
for attempt in range(3):
username = input("Enter username: ")
password = input("Enter password: ")
if username = correct_username and password = correct_password:
print("Login successful")
break
else:
print["Login failed"]
else:
print("All attempts used. Access denied.")
JOB JUNCTION
People who are experts in Python programming may pursue careers as Python Developers,
Software Engineers or Data Analysts.
PEDAGOGY PATHWAYS
« Discuss all the topics covered in this chapter with the students.
« Demonstrate how indentation is used to define the body of a conditional statement.
96
Premium Edition-VIII

